$(function(){
    $(".sys_project_carousel").each(function(idx,val) {
        var owl = $(this);
        owl.owlCarousel({items: 4});
        owl.parents(".wrap-carousel").on("click",".sys_btn_prev",function(){
            owl.trigger('owl.prev');
        });
        owl.parents(".wrap-carousel").on("click",".sys_btn_next",function(){
            owl.trigger('owl.next');
        });
    });
    $(".tabbable").on("click",".t-lbl",function(){
        var getIdx = $(this).index();
        $(this).addClass("active").siblings().removeClass("active").parents(".tabbable").find(".tab-content-item").removeClass("active").eq(getIdx).addClass("active");
    });
    $("#sys_kick_panel").on("click",function(){
        $("#sys_dropdown_login").fadeToggle(300);
    });

    if($("#sys_slider_pro_features").length > 0) {
        $(window).load(function(){
            var sys_lst_link_cate = $("#sys_lst_link_cate");
            var sys_lst_cate = $("#sys_lst_cate");
            var sys_slider_pro_features = $("#sys_slider_pro_features");
            sys_slider_pro_features.find(".overview").removeClass("hide-elem").end()
                .find(".tmp-loading").remove();
            var slided = sys_slider_pro_features.tinycarousel({
                axis:"y",
                bullets: true,
                easeFnAnimation: "easeInCirc",
                initSuccess:function(){
                    $("#sys_prev_feature_cate").on("click",function(){
                        sys_slider_pro_features.find(".prev").trigger("click");
                        return false;
                    });
                    $("#sys_next_feature_cate").on("click",function(){
                        sys_slider_pro_features.find(".next").trigger("click");
                        return false;
                    });
                }
            });
            var slide_data = sys_slider_pro_features.data("plugin_tinycarousel");
            sys_lst_cate.on("click","a",function(){
                var getIdx = $(this).parent().index();
                slide_data.move(getIdx);
                return false;
            });
            slided.bind("move",function(event,elem,idxElem){
                console.log(idxElem);
                sys_lst_link_cate.children().removeClass("active").eq(idxElem).addClass("active");
                sys_lst_cate.children().removeClass("active").eq(idxElem).addClass("active");
                var cateItemHeight = sys_lst_cate.children().first().outerHeight(true);
                sys_lst_cate.children(".mark").css("top", (cateItemHeight * idxElem) + "px");
            });
        });
    }
});

